import request from './request'

export function getRoles(params) {
  return request.get('/roles', { params })
}

export function getRoleById(id) {
  return request.get(`/roles/${id}`)
}

export function getRoleByCode(code) {
  return request.get(`/roles/by-code/${encodeURIComponent(code)}`)
}

export function getRoleByName(name) {
  return request.get(`/roles/by-name/${encodeURIComponent(name)}`)
}

export function createRole(data) {
  return request.post('/roles', data)
}

export function updateRole(id, data) {
  return request.put(`/roles/${id}`, data)
}

export function deleteRole(id) {
  return request.delete(`/roles/${id}`)
}


